/**
 * 
 */
package ru.opedge.notifical.bot.xmpp;

import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ChatManagerListener;

import ru.opedge.notifical.notification.service.INotificationService;

/**
 * @author opedge
 * 
 */
public class NotificationBotChatListener implements ChatManagerListener
{
	INotificationService service;

	private final int delay;

	public NotificationBotChatListener(final INotificationService service,
			final int delay)
	{
		this.service = service;
		this.delay = delay;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.jivesoftware.smack.ChatManagerListener#chatCreated(org.jivesoftware
	 * .smack.Chat, boolean)
	 */
	@Override
	public void chatCreated(final Chat chat, final boolean local)
	{
		chat.addMessageListener(new NotificationBotMessageListner(service,
				delay));
	}
}
